import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:framework/core/base_view.dart';
import 'package:framework/main.dart';
import 'package:module_discover/pages/filter_domain/filter_domain_logic.dart';
import 'package:module_discover/pages/filter_domain/widgets/domain_bottom_bar_widget.dart';
import 'package:module_discover/pages/filter_domain/widgets/domain_category_widget.dart';
import 'package:module_discover/pages/filter_domain/widgets/domain_content_widget.dart';
import 'package:module_discover/pages/model/Domain_info_model.dart';
import 'package:module_discover/route/discover_router.gr.dart';
import 'package:module_discover/widgets/app_bar_widget.dart';

@RoutePage()
class FilterDomainPage extends BaseView<FilterDomainLogic> {
  @PathParam()
  Map<String, Map<String, DomainInfoModel>>? chooseBackMaps;

  FilterDomainPage({
    super.key,
    required this.chooseBackMaps,
  });

  @override
  Widget buildView(BuildContext context, FilterDomainLogic logic) {
    logic.setChooseBackMaps(chooseBackMaps);
    return Scaffold(
      backgroundColor: JColor.color_f3f3f3,
      resizeToAvoidBottomInset: false,
      appBar: AppBarWidget.appBar("高级筛选", () {
        context.router.pop();
      }),
      bottomNavigationBar: DomainBottomBarWidget(
        logic: logic,
        onPressed: () {
          context.replaceRoute(
              FilterSearchRoute(maps: logic.filterPreviewVM.selectedMaps));
        },
      ),
      body: Column(
        children: [
          Divider(height: 0.5, thickness: 0.5, color: JColor.color_f3f3f3),
          Expanded(
              child: Row(
            children: [
              /// 左侧分类导航
              DomainCategoryWidget(logic: logic),

              SizedBox(width: Constants.px_4),

              /// 右侧二级列表
              Expanded(
                child: DomainContentWidget(logic: logic),
              ),
            ],
          ))
        ],
      ),
    );
  }

  @override
  FilterDomainLogic createLogic() => FilterDomainLogic();
}
